package week_home_work02;

import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/22
 */
public class Demo22 {
    public static void main(String[] args) {
        //打印一个数字金字塔，金字塔的高度由用户输入。
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入金字塔的高度:");
        int height = sc.nextInt();
        for (int i = 0; i < height; i++) {  //行
            for (int j = 0; j < height - 1 - i; j++) { // 空
                System.out.print(" ");
            }
            for (int j = 0; j < 2 * i + 1; j++) { //*
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
